<template>
	<view class="home">
		<navBar title="首页" left-icon="plusempty" @onLeftIcon="onLeftIcon"></navBar>
		<view class="home_container">
			<!-- 电站总数区域 -->
			<stationStatus />
			<!-- 整体发电概况 -->
			<stationPower />
			<!-- 发电图标日历 -->
			<stationCharts />
			<!--  -->
			<view style="height: 20rpx;">
			</view>
		</view>
	</view>
</template>

<script>
	import navBar from "@/components/navbar/index.vue"
	import stationStatus from './components/stationStatus'
	import stationCharts from './components/stationCharts'
	import stationPower from './components/stationPower.vue'
	export default {
		components: {
			navBar,
			stationStatus,
			stationCharts,
			stationPower
		},
		data() {
			return {};
		},
		onInit() {
			const token = uni.getStorageSync('Token')
			if (!token) {
				uni.reLaunch({
					url: "/pages/login/index"
				})
			}
		},
		onLoad() {

		},
		onPullDownRefresh() {
			uni.reLaunch({
				url: '/pages/tabbar/home/index'
			})
			uni.stopPullDownRefresh()
		},
		methods: {
			// 左上角加号点击
			onLeftIcon() {
				uni.navigateTo({
					url: '/pages/stations/addStation/index?path=home'
				});
			},
		}
	};
</script>

<style scoped lang="scss">
	.home {
		background-color: $bg-color;
	}
</style>